#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["SCZS.Example.UserMicroservice/SCZS.Example.UserMicroservice.csproj", "SCZS.Example.UserMicroservice/"]
COPY ["SCZS.Example.Core/SCZS.Example.Core.csproj", "SCZS.Example.Core/"]
COPY ["SCZS.Example.Common/SCZS.Example.Common.csproj", "SCZS.Example.Common/"]
COPY ["SCZS.Example.IService/SCZS.Example.IService.csproj", "SCZS.Example.IService/"]
COPY ["SCZS.Example.Model/SCZS.Example.Model.csproj", "SCZS.Example.Model/"]
COPY ["SCZS.Example.Service/SCZS.Example.Service.csproj", "SCZS.Example.Service/"]
RUN dotnet restore "SCZS.Example.UserMicroservice/SCZS.Example.UserMicroservice.csproj"
COPY . .
WORKDIR "/src/SCZS.Example.UserMicroservice"
RUN dotnet build "SCZS.Example.UserMicroservice.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "SCZS.Example.UserMicroservice.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SCZS.Example.UserMicroservice.dll"]